@extends('admin::layouts.master')
@section('title')
    商品订单
@endsection
<style>
    .ordertab{border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;font-size: 12px;}
    .ordertab td{border-right:1px solid #e6e6e6;border-bottom:1px solid #e6e6e6;padding: 0px 15px 0px 15px;}
    .orderbg{height:33px;line-height:33px;background:#e6e6e6;border-bottom:1px solid #d5d5d5;text-align:center;}
    .order_top span{color: #1890ff; font-size: 13px}
    .top_list{margin-left: 42px;}
    .price{color: red;}
</style>
@section('tab')

    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-tab">
                    <ul class="layui-tab-title">
                        <li data-type="" @if($arr_search['status']=='') class="layui-this" @endif>全部订单</li>
                        <li data-type="100" @if($arr_search['status']==100) class="layui-this" @endif>待支付订单</li>
                        <li data-type="200" @if($arr_search['status']==200) class="layui-this" @endif>待发货订单
                            @if($d_num > 0) <span class="layui-badge layui-bg-green">{{$d_num}}</span> @endif
                        </li>
                        <li data-type="2" @if($arr_search['status']==2) class="layui-this" @endif>已发货订单（待收货）</li>
                        <li data-type="3" @if($arr_search['status']==3) class="layui-this" @endif>待评价订单（已收货）</li>
                        <li data-type="5" @if($arr_search['status']==5) class="layui-this" @endif>已取消订单</li>
                    </ul>
                </div>
                <div class="layui-card">
                    <div class="layui-card-body ">
                        <form class="layui-form layui-col-space12">
                            <div class="layui-input-inline layui-show-xs-block" style="width:180px;">
                                <input type="text" name="order_no" placeholder="订单编号" value="{{$arr_search['order_no']}}" autocomplete="off" class="layui-input" id="order_no">
                            </div>

                            <div class="layui-input-inline">
                                <input type="text" name="range" class="layui-input" id="range" value="{{$arr_search['range']}}" placeholder=" 下单日期范围 " autocomplete="off" readonly>
                            </div>

                            <input type="hidden" name="status" id="status" value="{{$arr_search['status']}}">
                            <div class="layui-input-inline layui-show-xs-block">
                                <button class="layui-btn" lay-submit="" lay-filter="sreach">
                                    <i class="layui-icon">&#xe615;</i></button>
                                <a class="layui-btn layui-btn-small" onclick="location.reload()" title="刷新">
                                    <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
                                </a>
                                @if(!empty($data))
                                <a id ="export" class="layui-btn layui-btn-small">导出</a>
                                @endif
                            </div>
                        </form>
                    </div>
                    <div class="layui-card-body layui_overflow_y">

                        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="ordertab">
                            <tr class="orderbg">
                                <td style="padding-left: 15px;text-align: left">订单信息</td>
                                <td width="180">规格属性</td>
                                <td width="150">积分</td>
                                <td width="100">操作</td>
                            </tr>
                            @foreach($data as $key=>$value)
                                @if($key > 0)
                                    <tr height="20">
                                        <td colspan="5"></td>
                                    </tr>
                                @endif
                                <tr height="36">
                                    <td colspan="5" class="order_top">
                                        <span>下单时间：{{$value['created_at']}}</span>
                                        <span class="top_list">订单编号：{{$value['order_no']}}</span>
                                        <span class="top_list">订单状态：{{$value['order_status']}}</span>
                                    </td>
                                </tr>
                                    <tr align="center">
                                        <td height="80" style="text-align:left;">
                                            <span style="float:left ;align-self:center; display: flex;height:80px">
                                                <img src="{{$value['product_info']['pic']['full_src']}}" width="60" height="60" style="align-self: center;" />
                                            </span>
                                            <span style="display:flex; height:80px; padding-left:10px">
                                                <span style="line-height:20px; align-self:center;">
                                                    {{$value['get_goods_info']['name']}}
                                                </span>
                                            </span>
                                        </td>
                                        <td style="text-align: left">{{$value['product_info']['specs']['name']}}</td>

                                        <td>{{$value['goods_integral']}} x {{$value['goods_num']}} = {{$value['order_integral']}}（积分）</td>
                                        <td class="">
                                            <a title="详情" onclick="parent.xadmin.add_tab('订单详情','{{route("admin_order_details",["id"=>$value["id"]])}}',$(window).width(),$(window).height())" href="javascript:;">【查看详情】</a></br>
                                            @if($value['status'] == 5)
                                                <a title="删除" class="ajax_member_del" data-href="{{route('admin_order_delete',['id'=>$value['id']])}}" data-title="确定删除吗？请谨慎操作" href="javascript:;">【删除订单】</a>
                                            @endif
                                        </td>
                                    </tr>
                            @endforeach
                            @if(empty($data))
                                <td colspan="66" height="36" align="center">暂无数据</td>
                            @endif
                        </table>

                    </div>
                    <div class="layui-card-body ">
                        <div class="page">
                            {{$page_link}}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

@endsection

@section('tab_js')
    <script type="text/javascript">
        $(document).on('click', '.layui-tab-title li', function () {
            var type = $(this).attr('data-type');
            var data = '?status='+type;
            location_redirect('admin-order-integral'+data);
        });
        $(document).on('click', '#export', function () {
            location_redirect('admin-export-integral-order'+window.location.search);
        });
        layui.use('laydate', function(){
            var laydate = layui.laydate;
            //日期范围
            laydate.render({
                elem: '#range'
                ,range: true
            });
        });
    </script>
@endsection




